<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        /**
         * 基本数据类型
         */ 
        // var name = 'tom'
        var name = "tom"

        var age = 18

        var a = 5-'hello' // NaN

        var flag = true  // 布尔值

        var hobby = null 

        var address

        // console.log(typeof name)
        // console.log(typeof age)
        // console.log(a)
        // console.log(flag)
        // console.log(hobby)
        // console.log(address) // undefined 未赋值值

        var m = 8 

        var n = 8 + ''
        // console.log(typeof n)

        // console.log(Boolean(0))
        // console.log(Boolean(''))
        // console.log(Boolean(null))
        // console.log(Boolean(undefined))
        // console.log(Boolean(NaN))

        // if(m){
        //     console.log('嘿嘿')
        // }

        // console.log(5*2)
        // console.log(5**2) // 5的2次方，求幂

        // var x = 5
        // var y = '5'
        // console.log(x == y)
        // console.log(x === y) // 全等于，类型和值都相等


        // 定义数组
        var names = ['tom', 'jerry', 'lucy', 'jack','mike']
        console.log(names)

        // for(var i=0; i<names.length; i++){
        //     console.log(names[i])
        // }

        // for(var name of names){
        //     console.log(name)
        // }

        // for(var i in names){
        //     console.log(i, names[i])
        // }

        // console.log(names[1])
        // console.log(names[8])

        // names.sort()
        // console.log(names)

        // var nums = [6, 12, 4, 15, 86, 23, 129, 56]
        // console.log(nums)

        // nums.sort()
        // console.log(nums)

        // names.reverse()
        // names.push('张三')
        // console.log(names)

        // console.log(names.join('_'))

        // console.log(names.indexOf('jack'))

        console.log(names.slice(1,3))
        console.log(names.slice(1))


    </script>
</head>
<body>
    
</body>
</html>